# """
# This is the ImmutableListNode's API interface.
# You should not implement it, or speculate about its implementation.
# """
class ImmutableListNode:
    def printValue(self) -> None:  # print the value of this node.
        pass

    def getNext(self) -> 'ImmutableListNode':  # return the next node.
        pass


class Solution:
    def printLinkedListInReverse(self, head: 'ImmutableListNode') -> None:
        stack = []
        while head:
            stack.append(head)
            head = head.next
        while stack:
            stack.pop().printValue()


if __name__ == "__main__":
    pass
